package net.hn.hnms.biz.indicator.util;

import java.math.BigDecimal;

/**
 * @author 智呈物联 nzw
 * @date 2022/8/25
 */
public class ScoreLevel {

    public static int getLevel(BigDecimal score) {
        if(new BigDecimal(60).compareTo(score) >= 0) {
            return 1;
        } else if(new BigDecimal(60).compareTo(score) < 0 && new BigDecimal(75).compareTo(score) >= 0) {
            return 2;
        } else if(new BigDecimal(75).compareTo(score) < 0 && new BigDecimal(85).compareTo(score) >= 0) {
            return 3;
        } else {
            return 4;
        }
    }
    public static int getLevel(int score) {
        if(score < 60) {
            return 1;
        } else if(score >= 60 && score < 75) {
            return 2;
        } else if(score >= 75 && score < 85) {
            return 3;
        } else {
            return 4;
        }
    }

    public static String getRiskLevelString(int score) {
        return ConstantMap.RISK_LEVEL.get(getLevel(score));
    }

    public static String getRiskLevelString(double score) {
        return ConstantMap.RISK_LEVEL.get(getLevel(new BigDecimal(score)));
    }

    public static String getWarningLevelString(int score) {
        return ConstantMap.WARNING_LEVEL.get(getLevel(score));
    }

    public static String getRiskColorLevelString(int score) {
        return ConstantMap.RISK_COLOR_LEVEL.get(getLevel(score));
    }
}
